package com.instpower.things.instpower;

import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;

/**
 * @ClassName EventLoopGroupFactory
 * @Author: hellmash@gmail.com
 * @Date: 2020/2/24
 * @Version: 1.0.0
 * @Description: 定义两个主线程
 */
public class EventLoopGroupFactory {

    private final static Integer cpus = Runtime.getRuntime().availableProcessors();

    private static EventLoopGroup bossGroup = new NioEventLoopGroup(cpus);
    private static EventLoopGroup workerGroup = new NioEventLoopGroup(cpus * 2);

    private EventLoopGroupFactory() {
    }

    public static EventLoopGroup getBossGroup() {
        return bossGroup;
    }

    public static EventLoopGroup getWorkerGroup() {
        return workerGroup;
    }

}
